<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<p id="p">One paragraph in the document</p>

<script>
'use strict';

async_test((t) => {
  const axElement = accessibilityController.rootElement;
  axElement.setNotificationListener(t.step_func(function(notification, intents) {
    if (notification == 'SelectedTextChanged') {
      assert_array_equals(intents,
                          ['AXEventIntent(setSelection,none,character,forward)']);
      axElement.unsetNotificationListener();
      t.done();
    }
  }));

  const p = document.getElementById('p');
  const range = document.createRange();
  range.setStart(p.firstChild, 0);
  range.setEnd(p.firstChild, 1);
  window.getSelection().removeAllRanges();
  window.getSelection().addRange(range);
});

</script>
